home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5901 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: nntp.teleport.com!usenet
  2. From: GHouck <hksys@teleport.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: accessing structures (newbie question)
  5. Date: 21 Feb 1996 08:08:32 GMT
  6. Organization: systems hk
  7. Message-ID: <4geju0$sif@maureen.teleport.com>
  8. References: <4g8gic$o6u@news1.sunbelt.net> <3128FA60.5227@metagen.co.uk> <TANMOY.96Feb19090845@qcd.lanl.gov>
  9. NNTP-Posting-Host: ip-pdx06-14.teleport.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
  14.  
  15. tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) wrote:
  16. [snip]
  17. >What nonsense! Anything creates trouble if you do not take the time
  18. >to understand it.
  19. >
  20. >   I think you may have been using the wrong syntax when you tried the array 
  21. >   method. The xth item is given by 'photos[x].' which is equivalent to 
  22. >   '(photos + x * sizeof(picture))->'.
  23. >
  24. >This is the problem!!! photos[x]. is always the same as (photos + x)->
  25. >In fact, this is such a basic fact of pointer arithmetic that anyone
  26. >who posts such nonsense must surely be trying to deliberately mislead
  27. >newbies. We have enough confusion here: please refrain from posting
  28. >_answers_ unless you know at least the basics of C! 
  29. >
  30. Tanmoy,
  31.  
  32. Speaking of nonsense (your word), what is the meaning of your statement:
  33.  
  34. >   '(photos + x * sizeof(picture))->'.  ?
  35.  
  36. It may make sense conceptually, but syntactically you will step thru
  37. the array of structures rather quickly (by a factor of sizeof(picture)).
  38. Unless I'm mistaken, did you not mean:
  39. >    '(photos+x)->' ?
  40. To use your cordial words:  'We have enough confusion here: please refrain
  41. from posting _answers_ unless you know at least the basics of C!'
  42.  
  43. Yours, Geoff Houck
  44.  
  45.  
  46.